<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <input type="text" v-model="user.username">
        <div class="box">
            <input type="text" v-model="user.age">
        </div>
        <h1>{{user.username}}</h1>

        {{msg}}
    </div>
    <script src="./mvvm1.js"></script>
    <script>
        let vm = new Vue({
            el:'#app',
            data:{
                user:{
                    username:'zs',
                    age:18
                },
                msg:'hello'
            }
        })

        let obj1 = {name:'lili'};

        Object.defineProperty(obj1,'name',{
            set(newValue){

                //驱动视图更新

                console.log("4567890-======",newValue);

                console.log("设置值")
            },
            get(){
                console.log("获取值")
            }
        })

        obj1.name = 'zs';
    </script>
</body>
</html>